import React, { useEffect } from 'react';
import Strings from '@/i18n';
import Layout from '@/components/layout';
import { Analyze } from './components/Analyze';
import { View, Text } from '@ray-js/ray';
import styles from './index.module.less';

import { showToast } from '@ray-js/ray';
import { useState } from 'react';

import { Tab } from '@/components/tab';
import NavBarCustom from '@/components/NavBarCustom';

// import { getCustomConfig } from '@ray-js/ray';

export function Curve() {
  const [active, setActive] = useState(1);

  const [tab, setTab] = useState('toiletVisit');

  const onChange = e => {
    showToast({
      icon: 'none',
      title: `切换到 ${e.detail.title}`,
    });
  };

  useEffect(() => {
    // getCustomConfig({
    //   success: res => {
    //     console.log('获取配置成功:', res);
    //     // 直接使用配置
    //     const timeout = res.timeout || 5000;
    //     const enableDebug = res.enableDebug || false;
    //     const helpUrl = res.helpUrl || '';
    //   },
    //   fail: err => {
    //     console.error('获取配置失败:', err);
    //   },
    // });
  }, []);

  return (
    <Layout title={Strings.getLang('curve')} showBack={true}>
      <View className={styles.pageContent}>
        <View className={styles.pageTips}>
          <Text>{Strings.getLang('curveTips')}</Text>
        </View>

        <Tab tab={tab} setTab={setTab} />

        <Analyze current={tab} />
      </View>
    </Layout>
  );
}

export default Curve;
